//
//  AddFriendCell.m
//  BaseAPP
//
//  Created by Evisu on 16/12/20.
//  Copyright © 2016年 evisum. All rights reserved.
//

#import "AddFriendCell.h"

@interface AddFriendCell ()

@property (nonatomic, strong)UILabel *labTitle;

@property (nonatomic, strong)UILabel *labSubTitle;

@end

@implementation AddFriendCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.datas = [NSArray array];
        
        [self initViews];
        [self layoutViews];
    }
    
    return self;
}

- (void)initViews {

    self.ivIcon = [[UIImageView alloc] init];
    
    self.labTitle = [[UILabel alloc] init];
    self.labTitle.font = [UIFont systemFontOfSize:14];
    self.labTitle.textColor = HEXColor(@"171717");
    
    self.labSubTitle = [[UILabel alloc] init];
    self.labSubTitle.font = [UIFont systemFontOfSize:14];
    self.labSubTitle.textColor = HEXColor(@"b3b3b3");

    [self.contentView addSubview:self.ivIcon];
    [self.contentView addSubview:self.labTitle];
    [self.contentView addSubview:self.labSubTitle];
}


- (void)layoutViews {

    self.ivIcon.sd_layout
    .centerYEqualToView(self.contentView)
    .leftSpaceToView(self.contentView, 16)
    .widthIs(36)
    .heightIs(36);
    
    self.labTitle.sd_layout
    .topSpaceToView(self.contentView, 13)
    .leftSpaceToView(self.ivIcon, 16)
    .heightIs(14)
    .rightSpaceToView(self.contentView, 60);
    
    self.labSubTitle.sd_layout
    .bottomSpaceToView(self.contentView, 13)
    .leftSpaceToView(self.ivIcon, 16)
    .heightIs(14)
    .rightSpaceToView(self.contentView, 60);
}

- (void)setDatas:(NSArray *)datas {

    _datas = datas;
    if (datas.count>0) {
        NSString *str = datas.lastObject;
        self.ivIcon.image = [UIImage imageNamed:str];
        self.labTitle.text = datas.firstObject;
        self.labSubTitle.text = _datas[1];
    }
}


@end
